package com.sfzy.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sfzy.mapper.MyNoticeMapper;
import com.sfzy.service.MyNoticeService;
import com.sfzy.entity.MyNotice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MyNoticeServiceImpl implements MyNoticeService {
    @Autowired
    private MyNoticeMapper myNoticeMapper;
    @Override
    public int addMyNotice(MyNotice myNotice) {
        return myNoticeMapper.addMyNotice(myNotice);
    }

    @Override
    public int deleteMyNotice(int id) {
        return myNoticeMapper.deleteMyNotice(id);
    }

    @Override
    public int updateMyNotice(MyNotice myNotice) {
        return myNoticeMapper.updateMyNotice(myNotice);
    }

    @Override
    public MyNotice getMyNotice(int id) {
        return myNoticeMapper.getMyNotice(id);
    }

    @Override
    public List<MyNotice> getMyNotices() {
        return myNoticeMapper.getMyNotices();
    }

    @Override
    public PageInfo<MyNotice> getMyNoticesByPage(MyNotice myNotice, int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<MyNotice> list = myNoticeMapper.getMyNotices();
        PageInfo<MyNotice> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }
}
